package com.chenjie.executor.day14;

/**
 * packageName com.chenjie.executor.day14
 *
 * @author chenjie
 * @version JDK 8
 * @className TicketTask (此处以class为例)
 * @date 2024/5/28
 * @description TODO
 */
public class TicketTask implements Runnable {
    private int quantity=10;

    @Override
    public  void run() {
        synchronized (this){
            while (quantity>0){
                //打印车票
                System.out.println(Thread.currentThread().getName()+"---"+quantity+"号票");
                quantity--;
            }
        }
    }
}
